/*
 * Copyright 2011 Angel Sanadinov
 *
 * This file is part of VBox WMI.
 *
 * VBox WMI is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * VBox WMI is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with VBox WMI.  If not, see <http://www.gnu.org/licenses/>.
 */

package Beans.Requests.MachineManagement.Components;

/**
 * This class represents the memory settings of a virtual machine.
 *
 * @author Angel Sanadinov
 */
public class MemorySettings extends MachineManagementComponent
{
    private int ramSize;                //the RAM size in MB
    private int ramBalloonSize;         //RAM balloon size in MB
    private boolean isPageFusionEnabled;//page fusion state

    /**
     * Constructs a memory settings object with the specified data.
     *
     * @param ramSize the RAM size in MB
     * @param ramBalloonSize the RAM balloon size in MB
     * @param pageFusionEnabled page fusion state
     */
    public MemorySettings(int ramSize, int ramBalloonSize, boolean pageFusionEnabled)
    {
        this.ramSize = ramSize;
        this.ramBalloonSize = ramBalloonSize;
        this.isPageFusionEnabled = pageFusionEnabled;
    }

    /**
     * Retrieves the size of the RAM on the machine.
     *
     * @return the RAM size in MB
     */
    public int getRamSize()
    {
        return ramSize;
    }

    /**
     * Retrieves the size of the RAM balloon size.
     *
     * @return the RAM balloon size in MB
     */
    public int getRamBalloonSize()
    {
        return ramBalloonSize;
    }

    /**
     * Retrieves the page fusion state.
     *
     * @return <code>true</code> if page fusion is enabled <code>false</code> if it is not
     */
    public boolean getIsPageFusionEnabled()
    {
        return isPageFusionEnabled;
    }

    @Override
    public boolean isValid()
    {
        if(ramSize > 0 && ramBalloonSize >= 0)
            return true;
        else
            return false;
    }
}
